#include "Vec2.h"
#include "MathBase.h"

Float SVec2::GetLength()
{
	return CMathBase::Sqrt(X * X + Y * Y);
}

Float SVec2::GetMax() const
{
	return X > Y ? X : Y;
}

void SVec2::Normalize()
{
	Float InvLength = CMathBase::InvSqrt(X * X + Y * Y);
	X *= InvLength;
	Y *= InvLength;
}



SVec2 SVec2::ToNormalized()
{
	SVec2 New = *this;
	New.Normalize();
	return New;
}

void SVec2::ToFloatArray(float OutArray[2]) const
{
	OutArray[0] = X;
	OutArray[1] = Y;
}

Float SVec2::CrossProduct(const SVec2& Other) const
{
	return X * Other.Y -Other.X * Y;
}

CString WH::ToString(const SVec2 &InValue)
{
	return U"SVec2(X:"+CString(InValue.X)+U",Y:"+CString(InValue.Y)+U")";
}
